{% load i18n %}
{% extends "main.html" %}
{% block title %}{{title}} - {{blog.title}}{% endblock %}
{% block blogcontainer %}
<!-- Dependencies -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js" ></script>
<!-- Drag and Drop source file -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/dragdrop/dragdrop-min.js" ></script>
{% if cur_photo %}
<div class="yui-g" id="albumsdiv">
        <H3>{% trans "Albums" %}</H3>
        <p>
    <div id="albums">
       <div id="photocontainer">
          <div id="photo">
              <div><img src="{{cur_photo.content.src}}?imgmax=800"/></div>
          </div>
       </div>
     </div>
</div>
<script type="text/javascript">
(function() {
    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
        dd1;

    cpedia_album_DDRegion = function(id, sGroup, config) {
        this.cont = config.cont;
        cpedia_album_DDRegion.superclass.constructor.apply(this, arguments);
    };

    YAHOO.extend(cpedia_album_DDRegion, YAHOO.util.DD, {
        cont: null,
        init: function() {
            //Call the parent's init method
            cpedia_album_DDRegion.superclass.init.apply(this, arguments);
            this.initConstraints();

            Event.on(window, 'resize', function() {
                this.initConstraints();
            }, this, true);
        },
        initConstraints: function() {
            //Get the top, right, bottom and left positions
            var region = Dom.getRegion(this.cont);

            //Get the element we are working on
            var el = this.getEl();

            //Get the xy position of it
            var xy = Dom.getXY(el);

            //Get the width and height
            var width = parseInt(Dom.getStyle(el, 'width'), 10);
            var height = parseInt(Dom.getStyle(el, 'height'), 10);

            //Set left to x minus left
            var left = xy[0] - region.left;

            //Set right to right minus x minus width
            var right = region.right - xy[0] - width;

            //Set top to y minus top
            var top = xy[1] - region.top;

            //Set bottom to bottom minus y minus height
            var bottom = region.bottom - xy[1] - height;

            //Set the constraints based on the above calculations
            this.setXConstraint(left, right);
            this.setYConstraint(top, bottom);
        }
    });

    Event.onDOMReady(function() {
        dd1 = new cpedia_album_DDRegion('photo', '', { cont: 'photocontainer' });
    });

})();
</script>
{% endif %}
{% endblock %}
